package cho114366.basic;

import java.util.Scanner;

public class J07_CalandarV1 {

	public static void main(String[] args) {
		// 2005년 1월 달력 출력

		Scanner sc = null;
		sc = new Scanner(System.in);
		System.out.println("임의의 년도를 입력하세요");
		int year = sc.nextInt();
		sc.close();

		final String title = "\t\tj a u r a r y 2 0 0 5";
		final String hdrline = "--------------------------------------------------";
		final String hdrdays = "sun\ttmon\ttue\ttwe\tthe\tfri\tsat";
		System.out.println(title);
		System.out.println(hdrline);
		System.out.println(hdrdays);

		//
		// for (int i = 1; i <= 31; ++i) {
		// if(i%7==0){
		// System.out.println(i+"");
		// }else
		// {System.out.print(i+"\t");
		// }
		System.out.println();
		// int skipday = 6;
		// 공백포함 달력
		int j;
		j = ((year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400) % 7 + 1;

		if (j == 7)
			j = 0;
		int y = j;

		for (int i = 1; i <= 31 + 6; ++i, --j) {
			if (j >= 1) {
				System.out.print(" " + "\t");
			} else if (i % 7 == 0) {
				System.out.println((i - y) + "");
			} else {
				System.out.print((i - y) + "\t");

			}
		}
	}
}
